import java.time.LocalDateTime;

/**
 * 关于join示例
 */
public class ThreadByJoin {
    public static void main(String[] args) throws InterruptedException {
        Thread t1=new Thread(()->{
            //1.张三开始上班
            System.out.println("1.张三开始上班"+ LocalDateTime.now());
            //2.张三正在上班
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            //3.张三下班
            System.out.println("3.张三下班"+LocalDateTime.now());
        });
        t1.start();
        t1.join(500);
        Thread t2=new Thread(()->{
            //1.李四开始上班
            System.out.println("1.李四开始上班"+LocalDateTime.now()
            );
            //2.李四正在上班
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            //3.李四下班
            System.out.println("3.李四下班"+LocalDateTime.now());
        });
        t2.start();
    }
}
